package cn.iocoder.yudao.module.tms.dal.mysql.customerfollowlog;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.tms.controller.admin.customerfollowlog.vo.CustomerFollowLogPageReqVO;
import cn.iocoder.yudao.module.tms.dal.dataobject.customerfollowlog.CustomerFollowLogDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CustomerFollowLogMapper extends BaseMapperX<CustomerFollowLogDO> {

    default PageResult<CustomerFollowLogDO> selectPage(CustomerFollowLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerFollowLogDO>()
                .eqIfPresent(CustomerFollowLogDO::getFollowUpId, reqVO.getFollowUpId())
                .eqIfPresent(CustomerFollowLogDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(CustomerFollowLogDO::getFollowType, reqVO.getFollowType())
                .betweenIfPresent(CustomerFollowLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerFollowLogDO::getId));
    }

    default List<CustomerFollowLogDO> selectListByFollowUpId(Long followUpId) {
        return selectList(CustomerFollowLogDO::getFollowUpId, followUpId);
    }

    default List<CustomerFollowLogDO> selectListByCompanyId(Long companyId) {
        return selectList(CustomerFollowLogDO::getCompanyId, companyId);
    }

}
